# flask 脚本
from flask_script import Manager, Server
from flask_migrate import Migrate, MigrateCommand
from app import create_app
from app import db

app = create_app('app.config')
app.config.from_object('app.config')

db.init_app(app)

migrate = Migrate(app, db)
manager = Manager(app)
# 命令是db
manager.add_command('db', MigrateCommand)
# 命令是runserver
manager.add_command("runserver", Server(host="0.0.0.0", port=app.config['PORT'], use_debugger=True))

if __name__ == '__main__':
    manager.run()
